#include <iostream>

#include "aobject.hpp"
#include "fact.hpp"
#include "parseur.hpp"

int main(int ac, char** av)
{
  //  Fact		pouet;
  Parseur*	parser = new Parseur();
  ObjManager*	oman = new ObjManager();
  std::map<int, std::string>	translate;

  translate[FALSE] = "FALSE";
  translate[TRUE] = "TRUE";
  translate[UNDEFINED] = "UNDEFINED";

  if (ac <= 1)
    {
      std::cout << "Usage : ./expertSystem [filename]\n";
      return 1;
    }
  parser->setFile(av[1]);
  while (parser->parseLine(oman));
  oman->displayObjs();
  oman->linkObjs();
  for (int i = 2; i < ac; ++i)
    {
      if (oman->getFact(av[i]))
	{
	  oman->getFact(av[i])->solve();
	  std::cout << "status de " << av[i] << " : " << translate[oman->getFact(av[i])->getState()] << std::endl;;
	}
      else
	std::cout << "Can't found : " << av[i] << std::endl;
    }
  return 0;
}
